#include "Texture.h"
#include "GraphicsWrapper.h"

Texture::Texture(SDL_Texture* texture, const Size& size)
    : texture(texture), size(size), scale(1)
{
}

Texture::~Texture()
{
    if (texture != NULL)
    {
        SDL_DestroyTexture(texture);
    }
}

void Texture::render(const Position& position)
{
    GraphicsWrapper::put(texture, Area(position, size.scale(scale)));
}

Size Texture::getSize()
{
    return size;
}

void Texture::setScale(double scale)
{
    this->scale = scale;
}

void Texture::setAlpha(int alpha)
{
    SDL_SetTextureAlphaMod(texture, alpha);
}
